package com.harth.blemultiplatform.ble.core


/**
 * Defines available Bluetooth LE write types.
 */
enum class WriteType {
    /**
     * Write characteristic, requesting acknowledgement by the remote device.
     */
    WITH_RESPONSE,

    /**
     * Write characteristic without requiring a response by the remote device.
     */
    WITHOUT_RESPONSE,

    /**
     * Write characteristic including authentication signature.
     */
    SIGNED;

    /**
     * Returns the characteristic property required for this write type.
     */
    val requiredProperty: CharacteristicProperty
        get() = when (this) {
            WITH_RESPONSE -> CharacteristicProperty.WRITE
            WITHOUT_RESPONSE -> CharacteristicProperty.WRITE_WITHOUT_RESPONSE
            SIGNED -> CharacteristicProperty.SIGNED_WRITE
        }
}
